home *** CD-ROM | disk | FTP | other *** search
/ BMUG Newsletter 1996 Spring / S96 NL CD.iso / New NL PD Collections / Sound Manager 3.1 / For Programmers / Interfaces / SoundInput.a < prev    next >
Encoding:
Text File  |  1995-08-24  |  10.7 KB  |  441 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        SoundInput.a
  3. ;
  4. ;    Contains:    Sound Input Interfaces.
  5. ;
  6. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  7. ;                All rights reserved.
  8. ;
  9. ;    Bugs:        Report bugs to Radar component “System Interfaces”, “Latest”
  10. ;
  11. ;
  12.  
  13.     IF &TYPE('__SOUNDINPUT__') = 'UNDEFINED' THEN
  14. __SOUNDINPUT__ SET 1
  15.  
  16.  
  17.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  18.     include 'Types.a'
  19.     ENDIF
  20. ;        include 'ConditionalMacros.a'                                ;
  21.  
  22.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  23.     include 'AppleEvents.a'
  24.     ENDIF
  25. ;        include 'Errors.a'                                            ;
  26. ;        include 'Memory.a'                                            ;
  27. ;            include 'MixedMode.a'                                    ;
  28. ;        include 'OSUtils.a'                                        ;
  29. ;        include 'Events.a'                                            ;
  30. ;            include 'Quickdraw.a'                                    ;
  31. ;                include 'QuickdrawText.a'                            ;
  32. ;                    include 'ScriptLayout.a'                        ;
  33. ;        include 'EPPC.a'                                            ;
  34. ;            include 'AppleTalk.a'                                    ;
  35. ;            include 'Files.a'                                        ;
  36. ;                include 'Finder.a'                                    ;
  37. ;            include 'PPCToolbox.a'                                    ;
  38. ;            include 'Processes.a'                                    ;
  39. ;        include 'Notification.a'                                    ;
  40. ;            include 'Collections.a'                                ;
  41. ;            include 'Kernel.a'                                        ;
  42. ;                include 'MachineExceptions.a'                        ;
  43. ;                include 'Timing.a'                                    ;
  44.  
  45.     IF &TYPE('__WINDOWS__') = 'UNDEFINED' THEN
  46.     include 'Windows.a'
  47.     ENDIF
  48. ;        include 'Controls.a'                                        ;
  49. ;            include 'Appearance.a'                                    ;
  50. ;            include 'TextObjects.a'                                ;
  51. ;                include 'Unicode.a'                                ;
  52. ;            include 'Menus.a'                                        ;
  53. ;        include 'Drag.a'                                            ;
  54. ;            include 'TextEdit.a'                                    ;
  55. ;                include 'TextServices.a'                            ;
  56. ;                    include 'Components.a'                            ;
  57. ;                    include 'LocaleObjects.a'                        ;
  58.  
  59.     IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
  60.     include 'Dialogs.a'
  61.     ENDIF
  62.  
  63.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  64.     include 'Files.a'
  65.     ENDIF
  66.  
  67.     IF &TYPE('__SOUND__') = 'UNDEFINED' THEN
  68.     include 'Sound.a'
  69.     ENDIF
  70.  
  71. siDeviceIsConnected                EQU        1                    ;input device is connected and ready for input
  72. siDeviceNotConnected            EQU        0                    ;input device is not connected
  73. siDontKnowIfConnected            EQU        -1                    ;can't tell if input device is connected
  74. siReadPermission                EQU        0                    ;permission passed to SPBOpenDevice
  75. siWritePermission                EQU        1                    ;permission passed to SPBOpenDevice
  76.  
  77. ;Info Selectors for Sound Input Drivers
  78. siActiveChannels                EQU        'chac'                ;active channels
  79. siActiveLevels                    EQU        'lmac'                ;active meter levels
  80. siAGCOnOff                        EQU        'agc '                ;automatic gain control state
  81. siAsync                            EQU        'asyn'                ;asynchronous capability
  82. siChannelAvailable                EQU        'chav'                ;number of channels available
  83. siCompressionAvailable            EQU        'cmav'                ;compression types available
  84. siCompressionFactor                EQU        'cmfa'                ;current compression factor
  85. siCompressionHeader                EQU        'cmhd'                ;return compression header
  86. siCompressionNames                EQU        'cnam'                ;compression type names available
  87. siCompressionType                EQU        'comp'                ;current compression type
  88. siContinuous                    EQU        'cont'                ;continous recording
  89. siDeviceBufferInfo                EQU        'dbin'                ;size of interrupt buffer
  90. siDeviceConnected                EQU        'dcon'                ;input device connection status
  91. siDeviceIcon                    EQU        'icon'                ;input device icon
  92. siDeviceName                    EQU        'name'                ;input device name
  93. siHardwareBusy                    EQU        'hwbs'                ;sound hardware is in use
  94. siInputGain                        EQU        'gain'                ;input gain
  95. siInputSource                    EQU        'sour'                ;input source selector
  96. siInputSourceNames                EQU        'snam'                ;input source names
  97. siLevelMeterOnOff                EQU        'lmet'                ;level meter state
  98. siModemGain                        EQU        'mgai'                ;modem input gain
  99. siNumberChannels                EQU        'chan'                ;current number of channels
  100. siOptionsDialog                    EQU        'optd'                ;display options dialog
  101. siPlayThruOnOff                    EQU        'plth'                ;playthrough state
  102. siRecordingQuality                EQU        'qual'                ;recording quality
  103. siSampleRate                    EQU        'srat'                ;current sample rate
  104. siSampleRateAvailable            EQU        'srav'                ;sample rates available
  105. siSampleSize                    EQU        'ssiz'                ;current sample size
  106. siSampleSizeAvailable            EQU        'ssav'                ;sample sizes available
  107. siSetupCDAudio                    EQU        'sucd'                ;setup sound hardware for CD audio
  108. siSetupModemAudio                EQU        'sumd'                ;setup sound hardware for modem audio
  109. siStereoInputGain                EQU        'sgai'                ;stereo input gain
  110. siTwosComplementOnOff            EQU        'twos'                ;two's complement state
  111. siVoxRecordInfo                    EQU        'voxr'                ;VOX record parameters
  112. siVoxStopInfo                    EQU        'voxs'                ;VOX stop parameters
  113. siCloseDriver                    EQU        'clos'                ;reserved for internal use only
  114. siInitializeDriver                EQU        'init'                ;reserved for internal use only
  115. siPauseRecording                EQU        'paus'                ;reserved for internal use only
  116. siUserInterruptProc                EQU        'user'                ;reserved for internal use only
  117. ;Qualities
  118. siCDQuality                        EQU        'cd  '                ;44.1kHz, stereo, 16 bit
  119. siBestQuality                    EQU        'best'                ;22kHz, mono, 8 bit
  120. siBetterQuality                    EQU        'betr'                ;22kHz, mono, MACE 3:1
  121. siGoodQuality                    EQU        'good'
  122.  
  123. ; typedef struct SPB         SPB, *SPBPtr
  124. ;user procedures called by sound input routines
  125. SPB                     RECORD    0
  126. inRefNum                 ds.l   1        ; offset: $0 (0)        ;reference number of sound input device
  127. count                     ds.l   1        ; offset: $4 (4)        ;number of bytes to record
  128. milliseconds             ds.l   1        ; offset: $8 (8)        ;number of milliseconds to record
  129. bufferLength             ds.l   1        ; offset: $C (12)        ;length of buffer in bytes
  130. bufferPtr                 ds.l   1        ; offset: $10 (16)        ;buffer to store sound data in
  131. completionRoutine         ds.l   1        ; offset: $14 (20)        ;completion routine
  132. interruptRoutine         ds.l   1        ; offset: $18 (24)        ;interrupt routine
  133. userLong                 ds.l   1        ; offset: $1C (28)        ;user-defined field
  134. error                     ds.w   1        ; offset: $20 (32)        ;error
  135. unused1                     ds.l   1        ; offset: $22 (34)        ;reserved - must be zero
  136. sizeof                     EQU *            ; size:   $26 (38)
  137.                         ENDR
  138.  
  139. ; SPBVersion() returns a NumVersion
  140. ;
  141. ; pascal unsigned long SPBVersion(void)
  142. ;
  143.     IF ¬ GENERATINGCFM THEN
  144.         Macro
  145.         _SPBVersion
  146.             dc.w     $203C
  147.             dc.w     $0000
  148.             dc.w     $0014
  149.             dc.w     $A800
  150.         EndM
  151.     ELSE
  152.         IMPORT_CFM_FUNCTION    SPBVersion
  153.     ENDIF
  154.  
  155. ;
  156. ; pascal OSErr SndRecord(ModalFilterUPP filterProc, Point corner, OSType quality, SndListHandle *sndHandle)
  157. ;
  158.     IF ¬ GENERATINGCFM THEN
  159.         Macro
  160.         _SndRecord
  161.             dc.w     $203C
  162.             dc.w     $0804
  163.             dc.w     $0014
  164.             dc.w     $A800
  165.         EndM
  166.     ELSE
  167.         IMPORT_CFM_FUNCTION    SndRecord
  168.     ENDIF
  169.  
  170. ;
  171. ; pascal OSErr SndRecordToFile(ModalFilterUPP filterProc, Point corner, OSType quality, short fRefNum)
  172. ;
  173.     IF ¬ GENERATINGCFM THEN
  174.         Macro
  175.         _SndRecordToFile
  176.             dc.w     $203C
  177.             dc.w     $0708
  178.             dc.w     $0014
  179.             dc.w     $A800
  180.         EndM
  181.     ELSE
  182.         IMPORT_CFM_FUNCTION    SndRecordToFile
  183.     ENDIF
  184.  
  185. ;
  186. ; pascal OSErr SPBSignInDevice(short deviceRefNum, ConstStr255Param deviceName)
  187. ;
  188.     IF ¬ GENERATINGCFM THEN
  189.         Macro
  190.         _SPBSignInDevice
  191.             dc.w     $203C
  192.             dc.w     $030C
  193.             dc.w     $0014
  194.             dc.w     $A800
  195.         EndM
  196.     ELSE
  197.         IMPORT_CFM_FUNCTION    SPBSignInDevice
  198.     ENDIF
  199.  
  200. ;
  201. ; pascal OSErr SPBSignOutDevice(short deviceRefNum)
  202. ;
  203.     IF ¬ GENERATINGCFM THEN
  204.         Macro
  205.         _SPBSignOutDevice
  206.             dc.w     $203C
  207.             dc.w     $0110
  208.             dc.w     $0014
  209.             dc.w     $A800
  210.         EndM
  211.     ELSE
  212.         IMPORT_CFM_FUNCTION    SPBSignOutDevice
  213.     ENDIF
  214.  
  215. ;
  216. ; pascal OSErr SPBGetIndexedDevice(short count, Str255 deviceName, Handle *deviceIconHandle)
  217. ;
  218.     IF ¬ GENERATINGCFM THEN
  219.         Macro
  220.         _SPBGetIndexedDevice
  221.             dc.w     $203C
  222.             dc.w     $0514
  223.             dc.w     $0014
  224.             dc.w     $A800
  225.         EndM
  226.     ELSE
  227.         IMPORT_CFM_FUNCTION    SPBGetIndexedDevice
  228.     ENDIF
  229.  
  230. ;
  231. ; pascal OSErr SPBOpenDevice(ConstStr255Param deviceName, short permission, long *inRefNum)
  232. ;
  233.     IF ¬ GENERATINGCFM THEN
  234.         Macro
  235.         _SPBOpenDevice
  236.             dc.w     $203C
  237.             dc.w     $0518
  238.             dc.w     $0014
  239.             dc.w     $A800
  240.         EndM
  241.     ELSE
  242.         IMPORT_CFM_FUNCTION    SPBOpenDevice
  243.     ENDIF
  244.  
  245. ;
  246. ; pascal OSErr SPBCloseDevice(long inRefNum)
  247. ;
  248.     IF ¬ GENERATINGCFM THEN
  249.         Macro
  250.         _SPBCloseDevice
  251.             dc.w     $203C
  252.             dc.w     $021C
  253.             dc.w     $0014
  254.             dc.w     $A800
  255.         EndM
  256.     ELSE
  257.         IMPORT_CFM_FUNCTION    SPBCloseDevice
  258.     ENDIF
  259.  
  260. ;
  261. ; pascal OSErr SPBRecord(SPBPtr inParamPtr, Boolean asynchFlag)
  262. ;
  263.     IF ¬ GENERATINGCFM THEN
  264.         Macro
  265.         _SPBRecord
  266.             dc.w     $203C
  267.             dc.w     $0320
  268.             dc.w     $0014
  269.             dc.w     $A800
  270.         EndM
  271.     ELSE
  272.         IMPORT_CFM_FUNCTION    SPBRecord
  273.     ENDIF
  274.  
  275. ;
  276. ; pascal OSErr SPBRecordToFile(short fRefNum, SPBPtr inParamPtr, Boolean asynchFlag)
  277. ;
  278.     IF ¬ GENERATINGCFM THEN
  279.         Macro
  280.         _SPBRecordToFile
  281.             dc.w     $203C
  282.             dc.w     $0424
  283.             dc.w     $0014
  284.             dc.w     $A800
  285.         EndM
  286.     ELSE
  287.         IMPORT_CFM_FUNCTION    SPBRecordToFile
  288.     ENDIF
  289.  
  290. ;
  291. ; pascal OSErr SPBPauseRecording(long inRefNum)
  292. ;
  293.     IF ¬ GENERATINGCFM THEN
  294.         Macro
  295.         _SPBPauseRecording
  296.             dc.w     $203C
  297.             dc.w     $0228
  298.             dc.w     $0014
  299.             dc.w     $A800
  300.         EndM
  301.     ELSE
  302.         IMPORT_CFM_FUNCTION    SPBPauseRecording
  303.     ENDIF
  304.  
  305. ;
  306. ; pascal OSErr SPBResumeRecording(long inRefNum)
  307. ;
  308.     IF ¬ GENERATINGCFM THEN
  309.         Macro
  310.         _SPBResumeRecording
  311.             dc.w     $203C
  312.             dc.w     $022C
  313.             dc.w     $0014
  314.             dc.w     $A800
  315.         EndM
  316.     ELSE
  317.         IMPORT_CFM_FUNCTION    SPBResumeRecording
  318.     ENDIF
  319.  
  320. ;
  321. ; pascal OSErr SPBStopRecording(long inRefNum)
  322. ;
  323.     IF ¬ GENERATINGCFM THEN
  324.         Macro
  325.         _SPBStopRecording
  326.             dc.w     $203C
  327.             dc.w     $0230
  328.             dc.w     $0014
  329.             dc.w     $A800
  330.         EndM
  331.     ELSE
  332.         IMPORT_CFM_FUNCTION    SPBStopRecording
  333.     ENDIF
  334.  
  335. ;
  336. ; pascal OSErr SPBGetRecordingStatus(long inRefNum, short *recordingStatus, short *meterLevel, unsigned long *totalSamplesToRecord, unsigned long *numberOfSamplesRecorded, unsigned long *totalMsecsToRecord, unsigned long *numberOfMsecsRecorded)
  337. ;
  338.     IF ¬ GENERATINGCFM THEN
  339.         Macro
  340.         _SPBGetRecordingStatus
  341.             dc.w     $203C
  342.             dc.w     $0E34
  343.             dc.w     $0014
  344.             dc.w     $A800
  345.         EndM
  346.     ELSE
  347.         IMPORT_CFM_FUNCTION    SPBGetRecordingStatus
  348.     ENDIF
  349.  
  350. ;
  351. ; pascal OSErr SPBGetDeviceInfo(long inRefNum, OSType infoType, void *infoData)
  352. ;
  353.     IF ¬ GENERATINGCFM THEN
  354.         Macro
  355.         _SPBGetDeviceInfo
  356.             dc.w     $203C
  357.             dc.w     $0638
  358.             dc.w     $0014
  359.             dc.w     $A800
  360.         EndM
  361.     ELSE
  362.         IMPORT_CFM_FUNCTION    SPBGetDeviceInfo
  363.     ENDIF
  364.  
  365. ;
  366. ; pascal OSErr SPBSetDeviceInfo(long inRefNum, OSType infoType, void *infoData)
  367. ;
  368.     IF ¬ GENERATINGCFM THEN
  369.         Macro
  370.         _SPBSetDeviceInfo
  371.             dc.w     $203C
  372.             dc.w     $063C
  373.             dc.w     $0014
  374.             dc.w     $A800
  375.         EndM
  376.     ELSE
  377.         IMPORT_CFM_FUNCTION    SPBSetDeviceInfo
  378.     ENDIF
  379.  
  380. ;
  381. ; pascal OSErr SPBMillisecondsToBytes(long inRefNum, long *milliseconds)
  382. ;
  383.     IF ¬ GENERATINGCFM THEN
  384.         Macro
  385.         _SPBMillisecondsToBytes
  386.             dc.w     $203C
  387.             dc.w     $0440
  388.             dc.w     $0014
  389.             dc.w     $A800
  390.         EndM
  391.     ELSE
  392.         IMPORT_CFM_FUNCTION    SPBMillisecondsToBytes
  393.     ENDIF
  394.  
  395. ;
  396. ; pascal OSErr SPBBytesToMilliseconds(long inRefNum, long *byteCount)
  397. ;
  398.     IF ¬ GENERATINGCFM THEN
  399.         Macro
  400.         _SPBBytesToMilliseconds
  401.             dc.w     $203C
  402.             dc.w     $0444
  403.             dc.w     $0014
  404.             dc.w     $A800
  405.         EndM
  406.     ELSE
  407.         IMPORT_CFM_FUNCTION    SPBBytesToMilliseconds
  408.     ENDIF
  409.  
  410. ;
  411. ; pascal OSErr SetupSndHeader(SndListHandle sndHandle, short numChannels, UnsignedFixed sampleRate, short sampleSize, OSType compressionType, short baseNote, unsigned long numBytes, short *headerLen)
  412. ;
  413.     IF ¬ GENERATINGCFM THEN
  414.         Macro
  415.         _SetupSndHeader
  416.             dc.w     $203C
  417.             dc.w     $0D48
  418.             dc.w     $0014
  419.             dc.w     $A800
  420.         EndM
  421.     ELSE
  422.         IMPORT_CFM_FUNCTION    SetupSndHeader
  423.     ENDIF
  424.  
  425. ;
  426. ; pascal OSErr SetupAIFFHeader(short fRefNum, short numChannels, UnsignedFixed sampleRate, short sampleSize, OSType compressionType, unsigned long numBytes, unsigned long numFrames)
  427. ;
  428.     IF ¬ GENERATINGCFM THEN
  429.         Macro
  430.         _SetupAIFFHeader
  431.             dc.w     $203C
  432.             dc.w     $0B4C
  433.             dc.w     $0014
  434.             dc.w     $A800
  435.         EndM
  436.     ELSE
  437.         IMPORT_CFM_FUNCTION    SetupAIFFHeader
  438.     ENDIF
  439.  
  440.     ENDIF ; __SOUNDINPUT__
  441.